﻿<?xml version="1.0" encoding="utf-8"?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
  <CodeSnippet Format="1.0.0">
    <Header>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
      <Title>INPC Property</Title>
      <Author>Laurent Bugnion (GalaSoft)</Author>
      <Description>A property raising PropertyChanged. The class using this property should inherit GalaSoft.MvvmLight.ViewModelBase.</Description>
      <HelpUrl>http://www.galasoft.ch/mvvm/getstarted</HelpUrl>
      <Shortcut>mvvminpc</Shortcut>
    </Header>
    <Snippet>
      <Declarations>
        <Literal Editable="true">
          <ID>Type</ID>
          <ToolTip>Property type</ToolTip>
          <Default>Boolean</Default>
          <Function>
          </Function>
        </Literal>
        <Literal Editable="true">
          <ID>AttributeName</ID>
          <ToolTip>Attribute name</ToolTip>
          <Default>_myProperty</Default>
          <Function>
          </Function>
        </Literal>
        <Literal Editable="true">
          <ID>InitialValue</ID>
          <ToolTip>Initial value</ToolTip>
          <Default>false</Default>
          <Function>
          </Function>
        </Literal>
        <Literal Editable="true">
          <ID>PropertyName</ID>
          <ToolTip>Property name</ToolTip>
          <Default>MyProperty</Default>
          <Function>
          </Function>
        </Literal>
      </Declarations>
    <Code Language="VB">
      <![CDATA[''' <summary>
''' The <see cref="$PropertyName$" /> property's name.
''' </summary>
Public Const $PropertyName$PropertyName As String = "$PropertyName$"

Private $AttributeName$ As $Type$ = $InitialValue$

''' <summary>
''' Gets the $PropertyName$ property.
''' TODO Update documentation:
''' Changes to that property's value raise the PropertyChanged event. 
''' This property's value is broadcasted by the Messenger's default instance when it changes.
''' </summary>
Public Property $PropertyName$ As $Type$ 
   Get
     return $AttributeName$
   End Get
    
    Set(ByVal value as $Type$)
        If $AttributeName$ = value Then
          Exit Property
        End If
           
       dim oldValue as object = $AttributeName$
       $AttributeName$ = value

        ' Remove one of the two calls below
        throw new NotImplementedException()

        ' Update bindings, no broadcast
        RaisePropertyChanged($PropertyName$PropertyName)

        ' Update bindings and broadcast change using GalaSoft.MvvmLight.Messenging
        RaisePropertyChanged($PropertyName$PropertyName, oldValue, value, true)
    End Set
End Property]]>
    </Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>